/**
 * \file RegUtil.h
 * \brief Register utilities
 * \author Corey Tabaka
 *
 * Copyright (C) Corey Tabaka 2005.
 * All rights reserved.
 */

/*
   Copyright 2005 Corey Tabaka

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*/

#include <ktypes.h>
#include <platform/PageTable.h>
#include <platform/Descriptor.h>

#ifndef __KERNEL_REG_UTIL_H__
#define __KERNEL_REG_UTIL_H__

/**
 * \brief Format of the GDT pointer loaded into the GDT register
 */
extern struct {
	uint16 limit;
	void * address;
} __attribute__ ((packed)) gdtr ;

extern "C" {
	
void loadGDTR(seg_desc_t * gdt, uint32 limit);
void loadIDTR(int_desc_t * idt, uint32 limit);
void loadTR(seg_sel_t sel);
void loadDS(seg_sel_t ds);
void loadFS(seg_sel_t fs);
void loadCR3(page_entry_t *dir);
page_entry_t *getCR3(void);
uint32 getCR2(void);
uint32 getESP(void);
void enablePaging(int enable);
void invalidatePage(void *);

}

#endif
